package com.lz.a;

import java.util.Scanner;

/**
 * @ClassName Demo8
 * @Description 接收用户输入的3个整数,并将它们的最大值作为结果输出
 * @Author 2214361854
 * @Date 2022/5/26 22:35
 * @Version 1.0
 */
public class Demo8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("输入a：");
        int a = scanner.nextInt();
        System.out.print("输入b：");
        int b = scanner.nextInt();
        System.out.print("输入c：");
        int c = scanner.nextInt();
        maxA(a, b, c);
        System.out.println("=========");
        System.out.println("最大值：" + maxB(a, b, c));
    }

    /**
     * if elseif
     * @param a
     * @param b
     * @param c
     */
    private static void maxA(int a, int b, int c) {
        if (a > b && a > c) {
            System.out.println("最大值：" + a);
        } else if (b > c) {
            System.out.println("最大值：" + b);
        } else {
            System.out.println("最大值：" + c);
        }
    }

    /**
     * 三元
     * @param a
     * @param b
     * @param c
     * @return
     */
    private static int maxB(int a, int b, int c) {
        int max = a > b ? a : b;
        max = max > c ? max : c;
        return max;
    }
}
